﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kevin.Shop.Business.Comments.Components;
using Kevin.Shop.Business.Products.Components;
using Kevin.Shop.Business.Products.Components.Content;
using Kevin.Shop.Business.Service.Entity.Products.Enumerations;
using RiderShop.Mobile.Common.Component;

namespace RiderShop.Mobile.ServiceEntity.Product
{
    public class ProductBasicInfoExtend: ProductBasicInfo
    {
        public List<ProductReviewInfo> ProductCommentList { get; set; }
        public List<ProductImage> ImageList { get; set; }

        public string PromotionTypeIcon
        {
            get
            {
                return SiteUrl.FormatUrl("WebSite_Image_PromoIcon", PromotionTypeStr);
            }
        }

        public new string ActualImageUrl
        {
            get { return SiteUrl.FormatProductImageUrl(ImageType.Size350, ProductId, ImageName); }
        }

        public string ImageNameSize125
        {
            get { return SiteUrl.FormatProductImageUrl(ImageType.Size125, ProductId, ImageName); }
        }

        /// <summary>
        /// 显示两位小数的价格
        /// </summary>
        public string UnitPriceFormat
        {
            get { return UnitPrice.ToString("F2");}
        }

        /// <summary>
        /// 结束时间的格式化(因为josn返回的时间格式是1335258540000)
        /// </summary>
        public string EndDateFormat
        {
            get 
            {
                if (EndDate.HasValue)
                {
                    return EndDate.ToString();
                }
                else
                {
                    return "";
                }
            }
        }

        /// <summary>
        /// 开始时间的格式化(因为josn返回的时间格式是1335258540000)
        /// </summary>
        public string BeginDateFormat
        {
            get
            {
                if (BeginDate.HasValue)
                {
                    return BeginDate.ToString();
                }
                else
                {
                    return "";
                }
            }
        }

        /// <summary>
        /// 评论star数值
        /// </summary>
        public int CommentStar
        {
            get
            {
                if (ReviewCount > 40)
                {
                    return 5;
                }
                else if (ReviewCount < 40 && ReviewCount > 30)
                {
                    return 4;
                }
                else if (ReviewCount < 30 && ReviewCount > 20)
                {
                    return 3;
                }
                else if (ReviewCount < 20 && ReviewCount > 10)
                {
                    return 2;
                }
                else if (ReviewCount < 10 && ReviewCount > 0)
                {
                    return 1;
                }
                return 0;
            }
        }

        //总评论数
        private int _totalCommentCount = 0;
        public int TotalCommentCount
        {
            get { return _totalCommentCount; }
            set { _totalCommentCount = value; }
        }

        //很好评论数
        private int _bestCommentCount = 0;
        public int BestCommentCount
        {
            get { return _bestCommentCount; }
            set { _bestCommentCount = value; }
        }

        //好评论数
        private int _goodCommentCount = 0;
        public int GoodCommentCount
        {
            get { return _goodCommentCount; }
            set { _goodCommentCount = value; }
        }

        //一般评论数
        private int _normalCommentCount = 0;
        public int NormalCommentCount
        {
            get { return _normalCommentCount; }
            set { _normalCommentCount = value; }
        }

        //差评论数
        private int _badCommentCount = 0;
        public int BadCommentCount
        {
            get { return _badCommentCount; }
            set { _badCommentCount = value; }
        }

        //非常差评论数
        private int _worstCommentCount = 0;
        public int WorstCommentCount
        {
            get { return _worstCommentCount; }
            set { _worstCommentCount = value; }
        }

        //很好评论总页数
        private int _totalBestCommentPage;
        public int TotalBestCommentPage
        {
            get { return _totalBestCommentPage; }
            set { _totalBestCommentPage = value; }
        }

        //好评评论总页数
        private int _totalGoodCommentPage;
        public int TotalGoodCommentPage
        {
            get { return _totalGoodCommentPage; }
            set { _totalGoodCommentPage = value; }
        }

        //一般评论总页数
        private int _totalNormalCommentPage;
        public int TotalNormalCommentPage
        {
            get { return _totalNormalCommentPage; }
            set { _totalNormalCommentPage = value; }
        }

        //差评论总页数
        private int _totalBadCommentPage;
        public int TotalBadCommentPage
        {
            get { return _totalBadCommentPage; }
            set { _totalBadCommentPage = value; }
        }

        //非常差评论总页数
        private int _totalWorstCommentPage;
        public int TotalWorstCommentPage
        {
            get { return _totalWorstCommentPage; }
            set { _totalWorstCommentPage = value; }
        }

        //很好评和好评总页数
        private int _totalBestAndGoodCommentPage;
        public int TotalBestAndGoodCommentPage
        {
            get { return _totalBestAndGoodCommentPage; }
            set { _totalBestAndGoodCommentPage = value; }
        }

        //差评和非常差评总页数
        private int _totalBadAndWorstCommentPage;
        public int TotalBadAndWorstCommentPage
        {
            get { return _totalBadAndWorstCommentPage; }
            set { _totalBadAndWorstCommentPage = value; }
        }
    }
}
